import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 订单信息信息 */
export interface OrderItem {
          id: number; // ID
          orderSn?: string; // 订单号
          robotSn: string; // 机器人SN
          robotName: string; // 机器人名称
          taskId: string; // 任务ID
          menuSn?: string; // 菜单编码
          status?: number; // 状态（0：未完成、1：完成）
  }

// 订单信息 API
export const OrderItemApi = {
  // 查询订单信息分页
  getOrderItemPage: async (params: any) => {
    return await request.get({ url: `/rbt/order-item/page`, params })
  },

  // 查询订单信息详情
  getOrderItem: async (id: number) => {
    return await request.get({ url: `/rbt/order-item/get?id=` + id })
  },

  // 新增订单信息
  createOrderItem: async (data: OrderItem) => {
    return await request.post({ url: `/rbt/order-item/create`, data })
  },

  // 修改订单信息
  updateOrderItem: async (data: OrderItem) => {
    return await request.put({ url: `/rbt/order-item/update`, data })
  },

  // 删除订单信息
  deleteOrderItem: async (id: number) => {
    return await request.delete({ url: `/rbt/order-item/delete?id=` + id })
  },

  /** 批量删除订单信息 */
  deleteOrderItemList: async (ids: number[]) => {
    return await request.delete({ url: `/rbt/order-item/delete-list?ids=${ids.join(',')}` })
  },

  // 导出订单信息 Excel
  exportOrderItem: async (params) => {
    return await request.download({ url: `/rbt/order-item/export-excel`, params })
  }
}
